package com.accp.demo.controller.purchase;

import java.sql.Date;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.accp.demo.pojo.PageBean;
import com.accp.demo.pojo.purchase.PurchaseInstorage;
import com.accp.demo.service.purchase.PurchaseInstorageService;

@Controller
@RequestMapping("/purchaseInstorage")
public class PurchaseInstorageController {
	
	@Autowired
	private PurchaseInstorageService purchaseInstorageService;
	
/*	@RequestMapping(value="findNo",method=RequestMethod.GET)
	@ResponseBody
	public Object findNo(){
		 String date="2018-05-06";
		 
		return purchaseInstorageService.findNo(date);
	}*/
	
	@RequestMapping(value="/index",method=RequestMethod.GET)
	@ResponseBody 
	public PageBean index(@RequestBody Map<String,Object> map){
		System.out.println("进入查询采购入库:"+purchaseInstorageService.findByPage(map).getData().get(0).toString());
		return purchaseInstorageService.findByPage(map);
	}

	@RequestMapping(value="/saveOrUpdate",method=RequestMethod.POST)
	@ResponseBody 
	public void insert(@RequestBody Map<String,Object> map){
		System.out.println("controller："+map);
		purchaseInstorageService.insert(map);
		 
	}
	
	@RequestMapping(value="/delete")
	public void delete(String billNo){
		System.out.println("删除主祥:"+billNo);
		purchaseInstorageService.logicdelete(billNo);
	}
}
